﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Uber.Collections;
using Uber.Messages;

namespace Uber.HabboHotel.Rooms
{
    class RoomIcon
    {
        public int BackgroundImage;
        public int ForegroundImage;
        public SafeDictionary<int, int> Items;

        public RoomIcon(int mBackgroundImage, int mForegroundImage, SafeDictionary<int, int> mItems)
        {
            this.BackgroundImage = mBackgroundImage;
            this.ForegroundImage = mForegroundImage;
            this.Items = mItems;
        }

        public void Serialize(ServerMessage Message)
        {
            Message.AppendInt32(BackgroundImage);
            Message.AppendInt32(ForegroundImage);
            Message.AppendInt32(Items.Count);

            if (Items.Count > 0)
            {
                foreach (KeyValuePair<int, int> Item in Items)
                {
                    Message.AppendInt32(Item.Key);
                    Message.AppendInt32(Item.Value);
                }
            }
            else
            {
                Message.AppendInt32(0);
            }   
        }
    }
}
